package o;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader;
import android.graphics.Shader.TileMode;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.bumptech.glide.Glide;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;

public final class ccj {

    static class a extends wl {
        protected Bitmap ॱ(uc ucVar, Bitmap bitmap, int i, int i2) {
            return ˊ(ucVar, bitmap);
        }

        private Bitmap ˊ(uc ucVar, Bitmap bitmap) {
            int min = Math.min(bitmap.getWidth(), bitmap.getHeight());
            int width = (bitmap.getWidth() - min) / 2;
            int height = (bitmap.getHeight() - min) / 2;
            Bitmap ˊ = ucVar.ˊ(min, min, Config.ARGB_8888);
            if (ˊ == null) {
                ˊ = Bitmap.createBitmap(min, min, Config.ARGB_8888);
            }
            Canvas canvas = new Canvas(ˊ);
            Paint paint = new Paint();
            Shader bitmapShader = new BitmapShader(bitmap, TileMode.CLAMP, TileMode.CLAMP);
            if (!(width == 0 && height == 0)) {
                Matrix matrix = new Matrix();
                matrix.setTranslate((float) (-width), (float) (-height));
                bitmapShader.setLocalMatrix(matrix);
            }
            paint.setShader(bitmapShader);
            paint.setAntiAlias(true);
            float f = ((float) min) / 2.0f;
            canvas.drawCircle(f, f, f, paint);
            return ˊ;
        }

        public void ॱ(@NonNull MessageDigest messageDigest) {
            try {
                messageDigest.update(getClass().getName().getBytes("UTF-8"));
            } catch (UnsupportedEncodingException e) {
                bqx.ˏ("EditHeadImgCircleUtils", "updateDiskCacheKey exception : " + e.toString());
            }
        }

        public boolean equals(@NonNull Object obj) {
            return obj instanceof a;
        }

        public int hashCode() {
            return getClass().getPackage().hashCode();
        }
    }

    public static void ˎ(ImageView imageView, String str, String str2) {
        if (imageView != null) {
            ro ˏ = ˏ(imageView.getContext(), str);
            if (ˏ != null) {
                eqx.ˏ(ˏ, str2, imageView);
                ((ro) ˏ.ॱ(new era()).ॱ((zp) new zp().ˏ(new a())).ॱ(true)).ˏ(imageView);
            }
        }
    }

    private static ro<Bitmap> ˏ(Context context, String str) {
        try {
            return (ro) Glide.ˏ(context).ॱ().ˎ(str).ˊ(tf.ॱ);
        } catch (IllegalArgumentException e) {
            bqx.ˏ("EditHeadImgCircleUtils", "getBitmapBuilder Glide IllegalArgumentException");
            return null;
        }
    }
}
